<template>
    <div class="common-layout">
      <el-container>
        <el-aside width="200px">
            <Aside></Aside>

        </el-aside>
        <el-main>
            <RouterView></RouterView>
        </el-main>
      </el-container>
    </div>
  </template>
  
<script setup lang="ts">
import Aside from '@/components/menu/Aside.vue';
import {UserInfo} from '@/axios/index';
import { ElMessage } from 'element-plus'
import { RouterView } from 'vue-router';

onMounted(()=>{
    getUserInfo()
})

const getUserInfo = async ()=>{
  // Login
  const {data} = await UserInfo()
  const status = data.status
  switch (status) {
    case 200:
        const user = data.data.data.user.data
        localStorage.setItem('userInfo', JSON.stringify(user));
        break;
    case 401:
        const message = data.message
        ElMessage.error(message)
        localStorage.removeItem("userInfo")
        localStorage.removeItem("token")
        localStorage.removeItem("sysInfo")
    break;
  }
}

</script>


<style scoped>
.common-layout, .el-container{
    height: 100%

}


</style>